package com.bestcem.xm.member.entity.pojo;

import com.bestcem.xm.member.entity.mysql.ExportRecordEntity;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;

/**
 * 导出记录实体
 *
 * @author dc.wang <dc.wang@idiaoyan.com>
 * @date 2021-09-22
 */
@Getter
@Setter
public class ExportRecordDO {
    /**
     * 企业标识
     */
    private String exportId;

    /**
     * 企业标识
     */
    private String orgId;

    /**
     * 联系人类型
     */
    private Integer memberType;

    /**
     * 文件名
     */
    private String fileName;

    /**
     * 文件类型
     */
    private String fileType;

    /**
     * 文件大小
     */
    private String fileSize;

    /**
     * 文件路径
     */
    private String fileUrl;

    /**
     * 导出状态
     */
    private Integer status;

    /**
     * 文件导出的条件
     */
    private String params;

    /**
     * 导出异常信息
     */
    private String errorMsg;

    /**
     * 操作人标识
     */
    private String opUserId;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    public static ExportRecordEntity toEntity(ExportRecordDO recordDo) {
        if (recordDo == null) {
            return null;
        }

        ExportRecordEntity entity = new ExportRecordEntity();
        entity.setCreateTime(recordDo.getCreateTime());
        entity.setErrorMsg(recordDo.getErrorMsg());
        entity.setExportId(recordDo.getExportId());
        entity.setFileName(recordDo.getFileName());
        entity.setFileSize(recordDo.getFileSize());
        entity.setUpdateTime(recordDo.getUpdateTime());
        entity.setFileType(recordDo.getFileType());
        entity.setFileUrl(recordDo.getFileUrl());
        entity.setMemberType(recordDo.getMemberType());
        entity.setOpUserId(recordDo.getOpUserId());
        entity.setOrgId(recordDo.getOrgId());
        entity.setParams(recordDo.getParams());
        entity.setStatus(recordDo.getStatus());

        return entity;
    }

    public static ExportRecordDO toDo(ExportRecordEntity entity) {
        if (entity == null) {
            return null;
        }
        ExportRecordDO recordDo = new ExportRecordDO();
        recordDo.setCreateTime(entity.getCreateTime());
        recordDo.setErrorMsg(entity.getErrorMsg());
        recordDo.setExportId(entity.getExportId());
        recordDo.setFileName(entity.getFileName());
        recordDo.setFileSize(entity.getFileSize());
        recordDo.setUpdateTime(entity.getUpdateTime());
        recordDo.setFileType(entity.getFileType());
        recordDo.setFileUrl(entity.getFileUrl());
        recordDo.setMemberType(entity.getMemberType());
        recordDo.setOpUserId(entity.getOpUserId());
        recordDo.setOrgId(entity.getOrgId());
        recordDo.setParams(entity.getParams());
        recordDo.setStatus(entity.getStatus());
        return recordDo;
    }
}
